A good answer might be:

  1. How many times was the condition true? 3
  2. How many times did the block statement following the while execute? 3

Syntax of the while statement

Here is the syntax for the while statement:

while ( condition )
    statement 

Some notes on the syntax:

Since the statement can be a single statement or a block statement, a while statement can look like either of the following:

Varieties of while Statements

while ( condition )
    statement;

while ( condition )
{
    one or more statements
}

The style of indenting shown here leads to fewer errors than alternative styles.


QUESTION 4:

Is the booleanExpression always surrounded by parentheses?